Telegram Group & Telegram Channel
Напишите линейную регрессию на Python с нуля

Это один из самых простых алгоритмов. Он включает следующие шаги:
1️⃣ Инициализация параметров.
2️⃣ Вычисление предсказаний.
3️⃣ Вычисление функции потерь.
4️⃣ Обновление параметров с помощью градиентного спуска.
5️⃣ Повторение до сходимости.
import numpy as np

class LinearRegression:
def __init__(self, learning_rate=0.01, n_iters=1000):
self.learning_rate = learning_rate
self.n_iters = n_iters

def fit(self, X, y):
n_samples, n_features = X.shape
self.weights = np.zeros(n_features)
self.bias = 0

for _ in range(self.n_iters):
model_preds = self.predict(X)
dw = (1 / n_samples) * np.dot(X.T, (model_preds - y))
db = (1 / n_samples) * np.sum(model_preds - y)

self.weights -= self.learning_rate * dw
self.bias -= self.learning_rate * db

def predict(self, X):
return np.dot(X, self.weights) + self.bias


#машинное_обучение
#программирование
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/ds_interview_lib/273
Create:
Last Update:

Напишите линейную регрессию на Python с нуля

Это один из самых простых алгоритмов. Он включает следующие шаги:
1️⃣ Инициализация параметров.
2️⃣ Вычисление предсказаний.
3️⃣ Вычисление функции потерь.
4️⃣ Обновление параметров с помощью градиентного спуска.
5️⃣ Повторение до сходимости.

import numpy as np

class LinearRegression:
def __init__(self, learning_rate=0.01, n_iters=1000):
self.learning_rate = learning_rate
self.n_iters = n_iters

def fit(self, X, y):
n_samples, n_features = X.shape
self.weights = np.zeros(n_features)
self.bias = 0

for _ in range(self.n_iters):
model_preds = self.predict(X)
dw = (1 / n_samples) * np.dot(X.T, (model_preds - y))
db = (1 / n_samples) * np.sum(model_preds - y)

self.weights -= self.learning_rate * dw
self.bias -= self.learning_rate * db

def predict(self, X):
return np.dot(X, self.weights) + self.bias


#машинное_обучение
#программирование

BY Библиотека собеса по Data Science | вопросы с собеседований


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/ds_interview_lib/273

View MORE
Open in Telegram


Библиотека собеса по Data Science | вопросы с собеседований Telegram | DID YOU KNOW?

Date: |

How to Use Bitcoin?

n the U.S. people generally use Bitcoin as an alternative investment, helping diversify a portfolio apart from stocks and bonds. You can also use Bitcoin to make purchases, but the number of vendors that accept the cryptocurrency is still limited. Big companies that accept Bitcoin include Overstock, AT&T and Twitch. You may also find that some small local retailers or certain websites take Bitcoin, but you’ll have to do some digging. That said, PayPal has announced that it will enable cryptocurrency as a funding source for purchases this year, financing purchases by automatically converting crypto holdings to fiat currency for users. “They have 346 million users and they’re connected to 26 million merchants,” says Spencer Montgomery, founder of Uinta Crypto Consulting. “It’s huge.”

Dump Scam in Leaked Telegram Chat

A leaked Telegram discussion by 50 so-called crypto influencers has exposed the extraordinary steps they take in order to profit on the back off unsuspecting defi investors. According to a leaked screenshot of the chat, an elaborate plan to defraud defi investors using the worthless “$Few” tokens had been hatched. $Few tokens would be airdropped to some of the influencers who in turn promoted these to unsuspecting followers on Twitter.

Библиотека собеса по Data Science | вопросы с собеседований from jp


Telegram Библиотека собеса по Data Science | вопросы с собеседований
FROM USA